
layui.use(['form', 'admin','ax'], function () {
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;

    //获取菜单信息
    var ajax = new $ax(system.contextPath + "/admin/menuRole/search/id/" + system.getUrlParam("id"));
    var result = ajax.start();
    form.val('formContainer', result.data);

    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(system.contextPath + "/admin/menuRole/update/id/" + system.getUrlParam("id"), function (res) {
            if(res.status){
                system.success("修改成功！");
                //传给上个页面，刷新table用
                admin.putTempData('formOk', true);
                //关掉对话框
                admin.closeThisDialog();
            }else{
                system.error("修改失败！" + res.msg)
            }
        }, function (res) {
            system.error("修改失败！" + res.msg)
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });
});